# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: Leo <thinkabit.ukim@gmail.com>
pkgname=uinputplus
pkgver=0.1.4
pkgrel=0
pkgdesc="Wrapper around Linux's uinput system"
options="!check" # requires input device access
url="https://github.com/YukiWorkshop/libuInputPlus"
arch="all"
license="MIT"
depends_dev="linux-headers"
makedepends="cmake $depends_dev"
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/YukiWorkshop/libuInputPlus/archive/v$pkgver.tar.gz"
builddir="$srcdir/libuInputPlus-$pkgver"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		$CMAKE_CROSSOPTS .
	make -C build
}

package() {
	make -C build DESTDIR="$pkgdir" install
	rm -f "$pkgdir"/usr/lib/*.a
}

sha512sums="3b2c1bad3127fd6badd92e2d2ec528f68d0b9f3fdf22f1df81c3491533dcf95867a3e3b1919ad9cbcaf2e85ed3a209171b09bd709f2d71064facf344529ffdc4  uinputplus-0.1.4.tar.gz"
